Repository navigation
host: a team file linking to a file it cannot read is still reported as read through the link - #2432
Conversation
|
@Birfy review request for this exact tip: Red-first on a clean base plus the four gates are in the PR body; Please review |
… read through the link stateNotPlain() followed a symbolic link with stat() and asked only isFile(), so a target this host may not read still earned the link sentence: 'the store reads the team file through the link and the next save replaces the name'. The next row of the same report then said that read failed with EACCES, and no save ever renames over the name, because readFile() throws before writable() can become true. The target's read permission is now asked with access(path, R_OK) — no open, no byte — so a link to an unreadable file keeps the leaf sentence, which matches the Read-only row below it. Covered by one case that skips when the run is root. patches/ds-bot/0001-core-fixes.patch and 0007-version-and-tooling.patch are what generate writes.
8f53e37 to
350cc75
Compare
|
@Birfy review request for this exact tip: The tip moved once since the earlier request, and only to fix a placeholder the earlier head carried: Ready at this tip: red-first on a clean FlyBot Test read this change earlier at
|
|
Verdict: PASS at 350cc75 Ran at this tip: Read at this tip (tip tarball extracted to
Not run by me: the full suite, One note, not a blocker: the body's |
Fixes #2428
Owner: Dev-2
Written-by: Dev-2
Reviewer: Birfy
Claim-Id: dd4eb92fee9e442d8996b3752516122f
Branch: dev/2-linked-state-unreadable
Tip: 350cc75
Tree: 318a91e0d93f4bc4f3c4a0d004f123d475e97a47
Base: 16d1645
Diff: 6 files, +89/−10 (hand-written 4 = +43/−4; generated 2 = +46/−6)
Tier: T2 (why: [])
What changed
stateNotPlain()(core/src/host/diagnostics.js) followed a symbolic link withstat()and asked onlyisFile(). A file whose read bit is clear still answersisFile() === true, so astate.jsonlinking to it earned the link sentence —not a plain file (described only; the store reads the team file through the link and the next save replaces the name)— and the very next row of the same report said that read failed:| Read-only | The Bot team file … could not be read (EACCES). … |. Both halves cannot be true:readFile(statePath)throws beforewritable()can become true, so no save ever renames over the name.The target's read permission is now asked as well, with
access(path, R_OK)— it opens nothing and reads no byte, which is all this report may do with the team file. A link to a file this host may not read keeps the leaf sentencenot a plain file (nothing is read or written), the same one a link to a folder already gets forEISDIR, and the state line now agrees with theRead-onlyrow below it. A link to a readable plain file is unchanged, and so is a link to a folder or to nothing.patches/ds-bot/0001-core-fixes.patchand0007-version-and-tooling.patchare whatnode scripts/ds-bot-patches.mjs generatewrites; nothing in them is hand-edited.Red first
On a clean
16d16456worktree with onlycore/test/diagnostics.test.jsfrom this branch, the file was 58 tests / 57 pass / 1 fail / 0 skipped / 0 cancelled (logtmp/p555-red-final.log):The case builds a real
mode 000target behind a symlinkedstate.json, and also asserts theRead-onlyrow namingEACCES, so it pins both halves of the contradiction. It declaresskip:as a test option when the run is root (root reads a file without its read bits), the way the neighbouring#2364case skips that shape; with the fix the file is 58/58 on the same base.Ran
4844 = 2852+574+132+141+411+671+37+26, 0 fail / 0 cancelled; lint 0 errors (core 77 warnings, plugins 36/9/2/16);
arch-docs: OK (6 changed file(s)); 10 patches apply cleanly,core/equals ds-bot + patches, andgenerateis a no-op on the second run;build-client --checkexit 0;canonicalok.Not run
The smoke test (this touches no route and no client), CI's
packagejob (pack check, typecheck, actionlint), and CI itself. The new case cannot run as root by design, so a root-only CI runner would mark it skipped.Docs:
docs/subsystems/core-host.md— the report's state-file bullet now says a link to a plain file this host may not read keeps the leaf sentence, and namesaccess(path, R_OK)as the check.{
"pr": 2432,
"claim": "Dev-2",
"issue": 2428,
"summary": "diagnostics.js stateNotPlain() followed a link with stat() and asked only isFile(), so a state.json linking to a file this host cannot read still earned the read-through-the-link sentence, directly above a Read-only row reporting that same read failing with EACCES. It now also asks access(path, R_OK), which opens nothing and reads no byte, so such a link keeps the leaf sentence a link to a folder already gets for EISDIR. One test builds a mode-000 target behind the symlink and pins both halves, skipping under root.",
"files": [
"changelog.d/2428-linked-state-unreadable.fixed.md",
"core/src/host/diagnostics.js",
"core/test/diagnostics.test.js",
"docs/subsystems/core-host.md",
"patches/ds-bot/0001-core-fixes.patch",
"patches/ds-bot/0007-version-and-tooling.patch"
],
"checks": {
"ran": "TZ=UTC ARCH_DOCS_BASE=16d16456 npm run verify",
"result": "green",
"at": "350cc75cb24381582595a33ed0ea8d9be50223cf"
},
"next": "ready for review; the first review's tip is 350cc75"
}